module fn.pattern.functor_.Operators

(*
 * "Optionally" operator: a piping operator for Option<_> values.
 * if the input value is None, function is skipped and the eventual value is None.
 *)
let inline (|??) (xu: 'a option) (f: 'a -> 'b option) =
    match xu with
    | Some x -> f x
    | None -> None
let inline (|?) (xu: 'a option) (f: 'a -> 'b) = xu |?? (fun a -> Some (f a))

(*
 * "Implicit" operator
 *)
let inline (!>) (x:^a) : ^b = ((^a or ^b) : (static member op_Implicit : ^a -> ^b) x)
